﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Controller;

namespace QLKS
{
    public partial class FrmInfoRoom : Form
    {
        Controller_Room cont_room = new Controller_Room();
        public FrmInfoRoom()
        {
            InitializeComponent();
        }

        public void GetListRoomType()
        {
            DataTable dtRoom = cont_room.ListRoomType().Tables[0];
            cmbRoomtype.DataSource = dtRoom;
            cmbRoomtype.DisplayMember = "TypeName";
            cmbRoomtype.ValueMember = "RoomTypeID";

        }

        private void FrmInfoRoom_Load(object sender, EventArgs e)
        {
            GetListRoomType();
        }

        private void btn_getDS_Click(object sender, EventArgs e)
        {

            DataSet ds = new DataSet();
            rptTKLoaiPhong rptTK = new rptTKLoaiPhong();
            ds = cont_room.thongkeRoom(cmbRoomtype.SelectedValue.ToString());
            if (ds.Tables.Count != 0)
                rptTK.SetDataSource(ds.Tables[0]);
            rpt_thongkeLoaiPhong.ReportSource = rptTK;

        }

        private void cmbRoomtype_SelectedIndexChanged(object sender, EventArgs e)
        {
            btn_getDS_Click(sender, e);
        }
    }
}
